﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using YasharEl.Infrastructure.ResourcesManagement.Managers;

namespace YasharEl.Infrastructure.ResourcesManagement
{
    [ContractClass(typeof(ResourceProviderContract))]
    public interface IResourceProvider
    {
        #region Properties

        /// <summary>
        /// Gets the current name of the <see cref="System.Resources.ResourceManager"/> using this instance.
        /// </summary>
        /// <value>
        /// The current name of the <see cref="System.Resources.ResourceManager"/> using this instance.
        /// </value>
        string CurrentResourceManager
        {
            get;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Create a Resource Manager to manage the resources for a given resource provider
        /// </summary>
        /// <returns>A ResourceManager instance</returns>
        /// <remarks>This method makes a type of <see cref="System.Resources.ResourceManager"/> instance publicly available
        /// without the caller needing to know where the resources are provided from</remarks>
        ExtendedComponentResourceManager CreateResourceManager();

        #endregion
    }

    [ContractClassFor(typeof(IResourceProvider))]
    internal abstract class ResourceProviderContract : IResourceProvider
    {
        public string CurrentResourceManager
        {
            get
            {
                Contract.Result<string>();
                return default(string);
            }
        }

        public ExtendedComponentResourceManager CreateResourceManager()
        {
            return default(ExtendedComponentResourceManager);
        }
    }
}
